.class public Lcom/adview/adapters/AdBaiduAdapter;
.super Lcom/adview/adapters/AdViewAdapter;
.source "AdBaiduAdapter.java"

# interfaces
.implements Lcom/baidu/AdViewListener;


# instance fields
.field private adView:Lcom/baidu/AdView;


# direct methods
.method public constructor <init>(Lcom/adview/AdViewLayout;Lcom/adview/obj/Ration;)V
    .locals 0
    .parameter "adViewLayout"
    .parameter "ration"

    .prologue
    .line 22
    invoke-direct {p0, p1, p2}, Lcom/adview/adapters/AdViewAdapter;-><init>(Lcom/adview/AdViewLayout;Lcom/adview/obj/Ration;)V

    .line 24
    return-void
.end method


# virtual methods
.method public handle()V
    .locals 5

    .prologue
    .line 30
    invoke-static {}, Lcom/adview/AdViewTargeting;->getRunMode()Lcom/adview/AdViewTargeting$RunMode;

    move-result-object v2

    sget-object v3, Lcom/adview/AdViewTargeting$RunMode;->TEST:Lcom/adview/AdViewTargeting$RunMode;

    if-ne v2, v3, :cond_0

    .line 31
    const-string v2, "AdView SDK v1.7.0"

    const-string v3, "Into Baidu"

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 32
    :cond_0
    iget-object v2, p0, Lcom/adview/adapters/AdBaiduAdapter;->adViewLayoutReference:Ljava/lang/ref/WeakReference;

    invoke-virtual {v2}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/adview/AdViewLayout;

    .line 33
    .local v1, adViewLayout:Lcom/adview/AdViewLayout;
    if-nez v1, :cond_2

    .line 63
    :cond_1
    :goto_0
    return-void

    .line 36
    :cond_2
    iget-object v2, v1, Lcom/adview/AdViewLayout;->activityReference:Ljava/lang/ref/WeakReference;

    invoke-virtual {v2}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/Activity;

    .line 37
    .local v0, activity:Landroid/app/Activity;
    if-eqz v0, :cond_1

    .line 40
    iget-object v2, v1, Lcom/adview/AdViewLayout;->baiduView:Landroid/widget/RelativeLayout;

    if-nez v2, :cond_6

    .line 41
    invoke-static {}, Lcom/adview/AdViewTargeting;->getRunMode()Lcom/adview/AdViewTargeting$RunMode;

    move-result-object v2

    sget-object v3, Lcom/adview/AdViewTargeting$RunMode;->TEST:Lcom/adview/AdViewTargeting$RunMode;

    if-ne v2, v3, :cond_3

    .line 42
    const-string v2, "AdView SDK v1.7.0"

    const-string v3, "Baidu first into"

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 43
    :cond_3
    iget-object v2, p0, Lcom/adview/adapters/AdBaiduAdapter;->ration:Lcom/adview/obj/Ration;

    iget-object v2, v2, Lcom/adview/obj/Ration;->key3:Ljava/lang/String;

    const-string v3, "1"

    invoke-virtual {v2, v3}, Ljava/lang/String;->compareTo(Ljava/lang/String;)I

    move-result v2

    if-nez v2, :cond_5

    .line 44
    new-instance v2, Lcom/baidu/AdView;

    invoke-virtual {v1}, Lcom/adview/AdViewLayout;->getContext()Landroid/content/Context;

    move-result-object v3

    sget-object v4, Lcom/baidu/AdType;->IMAGE:Lcom/baidu/AdType;

    invoke-direct {v2, v3, v4}, Lcom/baidu/AdView;-><init>(Landroid/content/Context;Lcom/baidu/AdType;)V

    iput-object v2, v1, Lcom/adview/AdViewLayout;->baiduView:Landroid/widget/RelativeLayout;

    .line 48
    :cond_4
    :goto_1
    iget-object v2, v1, Lcom/adview/AdViewLayout;->baiduView:Landroid/widget/RelativeLayout;

    check-cast v2, Lcom/baidu/AdView;

    iput-object v2, p0, Lcom/adview/adapters/AdBaiduAdapter;->adView:Lcom/baidu/AdView;

    .line 49
    iget-object v2, p0, Lcom/adview/adapters/AdBaiduAdapter;->adView:Lcom/baidu/AdView;

    invoke-virtual {v2, p0}, Lcom/baidu/AdView;->setListener(Lcom/baidu/AdViewListener;)V

    .line 50
    iget-object v2, v1, Lcom/adview/AdViewLayout;->adViewManager:Lcom/adview/AdViewManager;

    invoke-virtual {v2}, Lcom/adview/AdViewManager;->resetRollover()V

    .line 51
    iget-object v2, v1, Lcom/adview/AdViewLayout;->handler:Landroid/os/Handler;

    new-instance v3, Lcom/adview/AdViewLayout$ViewAdRunnable;

    iget-object v4, p0, Lcom/adview/adapters/AdBaiduAdapter;->adView:Lcom/baidu/AdView;

    invoke-direct {v3, v1, v4}, Lcom/adview/AdViewLayout$ViewAdRunnable;-><init>(Lcom/adview/AdViewLayout;Landroid/view/ViewGroup;)V

    invoke-virtual {v2, v3}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    goto :goto_0

    .line 45
    :cond_5
    iget-object v2, p0, Lcom/adview/adapters/AdBaiduAdapter;->ration:Lcom/adview/obj/Ration;

    iget-object v2, v2, Lcom/adview/obj/Ration;->key3:Ljava/lang/String;

    const-string v3, "2"

    invoke-virtual {v2, v3}, Ljava/lang/String;->compareTo(Ljava/lang/String;)I

    move-result v2

    if-nez v2, :cond_4

    .line 46
    new-instance v2, Lcom/baidu/AdView;

    invoke-virtual {v1}, Lcom/adview/AdViewLayout;->getContext()Landroid/content/Context;

    move-result-object v3

    sget-object v4, Lcom/baidu/AdType;->TEXT:Lcom/baidu/AdType;

    invoke-direct {v2, v3, v4}, Lcom/baidu/AdView;-><init>(Landroid/content/Context;Lcom/baidu/AdType;)V

    iput-object v2, v1, Lcom/adview/AdViewLayout;->baiduView:Landroid/widget/RelativeLayout;

    goto :goto_1

    .line 56
    :cond_6
    invoke-static {}, Lcom/adview/AdViewTargeting;->getRunMode()Lcom/adview/AdViewTargeting$RunMode;

    move-result-object v2

    sget-object v3, Lcom/adview/AdViewTargeting$RunMode;->TEST:Lcom/adview/AdViewTargeting$RunMode;

    if-ne v2, v3, :cond_7

    .line 57
    const-string v2, "AdView SDK v1.7.0"

    const-string v3, "Baidu no first into"

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 58
    :cond_7
    iget-object v2, v1, Lcom/adview/AdViewLayout;->baiduView:Landroid/widget/RelativeLayout;

    check-cast v2, Lcom/baidu/AdView;

    iput-object v2, p0, Lcom/adview/adapters/AdBaiduAdapter;->adView:Lcom/baidu/AdView;

    .line 59
    iget-object v2, v1, Lcom/adview/AdViewLayout;->adViewManager:Lcom/adview/AdViewManager;

    invoke-virtual {v2}, Lcom/adview/AdViewManager;->resetRollover()V

    .line 60
    iget-object v2, v1, Lcom/adview/AdViewLayout;->handler:Landroid/os/Handler;

    new-instance v3, Lcom/adview/AdViewLayout$ViewAdRunnable;

    iget-object v4, p0, Lcom/adview/adapters/AdBaiduAdapter;->adView:Lcom/baidu/AdView;

    invoke-direct {v3, v1, v4}, Lcom/adview/AdViewLayout$ViewAdRunnable;-><init>(Lcom/adview/AdViewLayout;Landroid/view/ViewGroup;)V

    invoke-virtual {v2, v3}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 61
    invoke-virtual {v1}, Lcom/adview/AdViewLayout;->rotateThreadedDelayed()V

    goto/16 :goto_0
.end method

.method public onAdSwitch()V
    .locals 2

    .prologue
    .line 68
    invoke-static {}, Lcom/adview/AdViewTargeting;->getRunMode()Lcom/adview/AdViewTargeting$RunMode;

    move-result-object v0

    sget-object v1, Lcom/adview/AdViewTargeting$RunMode;->TEST:Lcom/adview/AdViewTargeting$RunMode;

    if-ne v0, v1, :cond_0

    .line 69
    const-string v0, "AdView SDK v1.7.0"

    const-string v1, "Baidu switch"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 71
    :cond_0
    return-void
.end method

.method public onReceiveFail(Lcom/baidu/FailReason;)V
    .locals 3
    .parameter "arg0"

    .prologue
    .line 76
    invoke-static {}, Lcom/adview/AdViewTargeting;->getRunMode()Lcom/adview/AdViewTargeting$RunMode;

    move-result-object v1

    sget-object v2, Lcom/adview/AdViewTargeting$RunMode;->TEST:Lcom/adview/AdViewTargeting$RunMode;

    if-ne v1, v2, :cond_0

    .line 77
    const-string v1, "AdView SDK v1.7.0"

    const-string v2, "Baidu failure"

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 79
    :cond_0
    iget-object v1, p0, Lcom/adview/adapters/AdBaiduAdapter;->adView:Lcom/baidu/AdView;

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Lcom/baidu/AdView;->setListener(Lcom/baidu/AdViewListener;)V

    .line 81
    iget-object v1, p0, Lcom/adview/adapters/AdBaiduAdapter;->adViewLayoutReference:Ljava/lang/ref/WeakReference;

    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/adview/AdViewLayout;

    .line 82
    .local v0, adViewLayout:Lcom/adview/AdViewLayout;
    if-nez v0, :cond_1

    .line 88
    :goto_0
    return-void

    .line 85
    :cond_1
    iget-object v1, v0, Lcom/adview/AdViewLayout;->adViewManager:Lcom/adview/AdViewManager;

    invoke-virtual {v1}, Lcom/adview/AdViewManager;->resetRollover_pri()V

    .line 86
    invoke-virtual {v0}, Lcom/adview/AdViewLayout;->rotateThreadedPri()V

    goto :goto_0
.end method

.method public onReceiveSuccess()V
    .locals 3

    .prologue
    .line 93
    invoke-static {}, Lcom/adview/AdViewTargeting;->getRunMode()Lcom/adview/AdViewTargeting$RunMode;

    move-result-object v1

    sget-object v2, Lcom/adview/AdViewTargeting$RunMode;->TEST:Lcom/adview/AdViewTargeting$RunMode;

    if-ne v1, v2, :cond_0

    .line 94
    const-string v1, "AdView SDK v1.7.0"

    const-string v2, "Baidu success"

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 96
    :cond_0
    iget-object v1, p0, Lcom/adview/adapters/AdBaiduAdapter;->adViewLayoutReference:Ljava/lang/ref/WeakReference;

    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/adview/AdViewLayout;

    .line 97
    .local v0, adViewLayout:Lcom/adview/AdViewLayout;
    if-nez v0, :cond_1

    .line 103
    :goto_0
    return-void

    .line 101
    :cond_1
    invoke-virtual {v0}, Lcom/adview/AdViewLayout;->rotateThreadedDelayed()V

    goto :goto_0
.end method
